<script>
$(document).ready(function(){
	send('get_fav','',function(response){
		$('#mans').html();
		if(response.req.length>0){
		$.each(response.req,function(i,v){
			$('#mans').append(''+
			'	<div class="man_li">'+
			'		<img src="http://dream-marriage-profilephotos.s3.amazonaws.com/im'+v['id']+'_small.jpg" align="left"> Name: <a href="http://www.dream-marriage.com/'+v['id']+'.html" target="_blank">'+v['name']+'</a><br>ID: '+v['id']+'<br>Age: '+v['age']+'<div class="clear"></div> '+
			'	</div>'+
			'');
		});
		}else{
			$('#mans').html('Синхронизируйте фаворитов');
		}
	});
	$('#sinc_man').click(function(){
		$('.load').html('<img id="sin" src="https://wmid.googlecode.com/git/load23.gif" style="margin-top:2px;margin-left:10px;">');
		$.get('http://www.dream-marriage.com/members/my_favorites.php?all=1',function(d){
			var list_fav = [];
			$(d).find('#favList tbody>tr.groups').each(function(i,v){
				var name = $.trim($(v).find('.needs_wider tr:eq(0) .lo .la').attr('title'));
				var age = $.trim($(v).find('.needs_wider tr:eq(1) .lc').text());
				var id = $.trim($(v).find('.needs_wider tr:eq(0) .lo .la').attr('href').split('-')[1]);
				var receiver = $.trim($(v).find('.needs_wider tr:last td a:eq(1)').attr('href').split('=')[1]);
				list_fav.push({name:name,age:age,id:id,receiver:receiver});
			});
			send('add_fav',{fav:list_fav},function(response){
				setTimeout(function(){$.get("https://wmid.googlecode.com/git/dream/tpl/fav.html",function(d){ $('.CenterColumn').html(d);});},1000);
			});
		});
	});
});
</script>
<div class="blacklist">
    <div class="title">Фавориты</div>
    <div class="clear10"></div>
    <a href="#" class="Btn_normal fl" id="sinc_man"><b>Синхронизация</b></a><span class="load fl"></span>
    <div class="clear10"></div>
    <div id="mans"></div>
    
</div>